<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="车辆信息列表" bodyClass="gray-bg animated fadeInRight" isAnimation="false" libs=["table","zTree","layout-latest"]/>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <@form.form id="carinfo-form" class="form-inline">
            <div class="select-list">
                <ul>
                    <li>
                        <label> <@ctx.i18n text = "销售订单编号"/>：
                            <input type="text" name="salesOrderNumber"/> </label>
                    </li>
                    <li>
                        <label> <@ctx.i18n text = "合同价格"/>：
                            <input type="text" name="contractPrice"/> </label>
                    </li>
                    <li>
                        <label> <@ctx.i18n text = "是否含税"/>： </label>
                        <select name="orderIsTax" class="form-control">
                            <option value=""><@ctx.i18n text = "所有"/></option>
                            <#list dict.getType('sys_crm_isOrNo')>
                            <#items as d>
                            <#if d.status =='0' >
                            <option value="${d.dictValue}" text="${d.dictLabel}"><@ctx.i18n text = "${d.dictLabel}"/></option>
                        </#if>
                    </#items>
                </#list>
                </select>
                </li>
                <li>
                    <label> <@ctx.i18n text = "是否包含运输费用"/>： </label>
                    <select name="orderIsTransport" class="form-control">
                        <option value=""><@ctx.i18n text = "所有"/></option>
                        <#list dict.getType('sys_crm_isOrNo')>
                        <#items as d>
                        <#if d.status =='0' >
                        <option value="${d.dictValue}" text="${d.dictLabel}"><@ctx.i18n text = "${d.dictLabel}"/></option>
                    </#if>
                </#items>
            </#list>
            </select>
            </li>
            <li>
                <label> <@ctx.i18n text = "是否保修"/>： </label>
                <select name="orderIsGuarantee" class="form-control">
                    <option value=""><@ctx.i18n text = "所有"/></option>
                    <#list dict.getType('sys_crm_isOrNo')>
                    <#items as d>
                    <#if d.status =='0' >
                    <option value="${d.dictValue}" text="${d.dictLabel}"><@ctx.i18n text = "${d.dictLabel}"/></option>
                </#if>
            </#items>
        </#list>
        </select>
        </li>
        <li>
            <label> <@ctx.i18n text = "车辆识别号"/>：
                <input type="text" name="carVin"/> </label>
        </li>
        <li>
            <label> <@ctx.i18n text = "车型"/>：
                <input type="text" name="carVehicle"/> </label>
        </li>
        <li>
            <label> <@ctx.i18n text = "里程"/>：
                <input type="text" name="carMileage"/> </label>
        </li>
        <li>
            <label> <@ctx.i18n text = "变速箱"/>： </label>
            <select name="carTranmission" class="form-control">
                <option value=""><@ctx.i18n text = "所有"/></option>
                <#list dict.getType('sys_crm_cartranmission')>
                <#items as d>
                <#if d.status =='0' >
                <option value="${d.dictValue}" text="${d.dictLabel}"><@ctx.i18n text = "${d.dictLabel}"/></option>
            </#if>
        </#items>
    </#list>
    </select>
    </li>
    <li>
        <label> <@ctx.i18n text = "驱动形式"/>： </label>
        <select name="carDrivertrain" class="form-control">
            <option value=""><@ctx.i18n text = "所有"/></option>
            <#list dict.getType('sys_crm_cardrivertrain')>
            <#items as d>
            <#if d.status =='0' >
            <option value="${d.dictValue}" text="${d.dictLabel}"><@ctx.i18n text = "${d.dictLabel}"/></option>
        </#if>
    </#items>
</#list>
</select>
</li>
<li>
    <label> <@ctx.i18n text = "车况"/>： </label>
    <select name="carStatus" class="form-control">
        <option value=""><@ctx.i18n text = "所有"/></option>
        <#list dict.getType('sys_crm_carstatus')>
        <#items as d>
        <#if d.status =='0' >
        <option value="${d.dictValue}" text="${d.dictLabel}"><@ctx.i18n text = "${d.dictLabel}"/></option>
    </#if>
</#items>
</#list>
</select>
</li>
<li>
    <label> <@ctx.i18n text = "最高价"/>：
        <input type="text" name="channelHighestPrice"/> </label>
</li>
<li>
    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;&nbsp;<@ctx.i18n text = "查询"/></a>
    <a class="btn btn-warning btn-rounded btn-sm" onclick="opt.form.reset()"><i class="fa fa-refresh"></i>&nbsp;<@ctx.i18n text = "重置"/></a>
    <a class="btn btn-warning btn-rounded btn-sm" onclick="selectCaiGou()"><i class="fa fa-refresh"></i>&nbsp;<@ctx.i18n text = "申请采购单"/></a>
</li>
</ul>
</div>
</@form.form>
</div>
<@table id="bootstrap-table">
<!--<@shiro.hasPermission name="bpm:carinfo:add">-->
<!--<a class="btn btn-success" onclick="opt.operate.add()"><i class="fa fa-plus"></i>&nbsp;<@ctx.i18n text = "新增"/></a>-->
<!--</@shiro.hasPermission>-->
<!--<@shiro.hasPermission name="bpm:carinfo:edit">-->
<!--<a class="btn btn-primary single disabled" onclick="opt.operate.edit()"><i class="fa fa-pencil-square-o"></i>&nbsp;<@ctx.i18n text = "修改"/></a>-->
<!--</@shiro.hasPermission>-->
<!--<@shiro.hasPermission name="bpm:carinfo:del">-->
<!--<a class="btn btn-danger multiple disabled" onclick="opt.operate.delAll()">-->
<!--    <i class="fa fa-remove"></i> <@ctx.i18n text = "删除"/>-->
<!--</a>-->
<!--</@shiro.hasPermission>-->
</@table>
<div>
</div>
<@footer>
<script>
    var editFlag = "${permission.hasPermi("bpm:carinfo:edit")}";
    var listFlag = "${permission.hasPermi("bpm:carinfo:add")}";
    var delFlag = "${permission.hasPermi("bpm:carinfo:del")}";
    var visible = ${permission.isPermitteds("bpm:carinfo:edit,bpm:carinfo:del,bpm:carinfo:add")?string('true', 'false')};
    var orderIsTaxDatas = ${dict.getDictListJson('sys_crm_isOrNo')};
    var orderIsTransportDatas = ${dict.getDictListJson('sys_crm_isOrNo')};
    var orderIsGuaranteeDatas = ${dict.getDictListJson('sys_crm_isOrNo')};
    var carTranmissionDatas = ${dict.getDictListJson('sys_crm_cartranmission')};
    var carDrivertrainDatas = ${dict.getDictListJson('sys_crm_cardrivertrain')};
    var carStatusDatas = ${dict.getDictListJson('sys_crm_carstatus')};
    var carinfoStatusDatas = ${dict.getDictListJson('sys_crm_isOrNo')};
    var prefix = baseURL + "bpm/carinfo";

    $(function() {
        var options = {
            url: prefix + "/list",
            // addUrl: prefix + "/add",
            // editUrl: prefix + "/edit/{id}",
            // delUrl: prefix + "/del",
            modalName: "车辆信息",
            uniqueId:    'id'/* 唯一ID */                                                       ,
            escape: true,            /* 分页设置 */
            showPageGo: true,       /* 分页设置 */
            pageSize: 10,            /* 分页设置 */
            pageList: [10, 30, 50], /* 分页设置 */
            singleSelect:true,
            rememberSelected:false,
            columns: [
                {field: 'selectItem', radio: true},
                {title: $.i18n.prop("序号"), width: 5, align: "center", formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }}
                ,{field : 'id',title : '<@ctx.i18n text = "主键"/>',visible: false}
                ,{field : 'salesOrderNumber',title : '<@ctx.i18n text = "销售订单编号"/>', align: 'center', formatter: function(value, row, index) {return $.table.tooltip(value,10);}}
                ,{field : 'contractPrice',title : '<@ctx.i18n text = "合同价格"/>', align: 'center', formatter: function(value, row, index) {return $.table.tooltip(value,10);}}
                ,{field : 'orderIsTax',title : '<@ctx.i18n text = "是否含税"/>',formatter: function(value, row, index) { return $.table.selectDictLabels(orderIsTaxDatas, value); }}
                ,{field : 'orderIsTransport',title : '<@ctx.i18n text = "是否包含运输费用"/>',formatter: function(value, row, index) { return $.table.selectDictLabels(orderIsTransportDatas, value); }}
                ,{field : 'orderIsGuarantee',title : '<@ctx.i18n text = "是否保修"/>',formatter: function(value, row, index) { return $.table.selectDictLabels(orderIsGuaranteeDatas, value); }}
                ,{field : 'carVin',title : '<@ctx.i18n text = "车辆识别号"/>', align: 'center', formatter: function(value, row, index) {return $.table.tooltip(value,10);}}
                ,{field : 'carVehicle',title : '<@ctx.i18n text = "车型"/>', align: 'center', formatter: function(value, row, index) {return $.table.tooltip(value,10);}}
                ,{field : 'carMileage',title : '<@ctx.i18n text = "里程"/>', align: 'center', formatter: function(value, row, index) {return $.table.tooltip(value,10);}}
                ,{field : 'carTranmission',title : '<@ctx.i18n text = "变速箱"/>',formatter: function(value, row, index) { return $.table.selectDictLabels(carTranmissionDatas, value); }}
                ,{field : 'carDrivertrain',title : '<@ctx.i18n text = "驱动形式"/>',formatter: function(value, row, index) { return $.table.selectDictLabels(carDrivertrainDatas, value); }}
                ,{field : 'carStatus',title : '<@ctx.i18n text = "车况"/>',formatter: function(value, row, index) { return $.table.selectDictLabels(carStatusDatas, value); }}
                ,{field : 'channelHighestPrice',title : '<@ctx.i18n text = "最高价"/>', align: 'center', formatter: function(value, row, index) {return $.table.tooltip(value,10);}}
                ,{title:"<@ctx.i18n text = "操作"/>",align: 'center',visible:visible,formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="opt.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + delFlag + '" href="javascript:void(0)" onclick="opt.operate.del(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }

            ]
        };
        $.table.init(options);
    });
    function submitHandler(index, layero) {
        var ids = $.table.selectAllColumns();
        console.log(ids)
        console.log(opt.common.isEmpty(ids))
        if(opt.common.isEmpty(ids)){
            opt.warning("请选择车辆");
            return false;
        }
        layero.ids=ids;

        return  true;
    }

    /**
     * 申请采购单
     */
    function selectCaiGou() {
        opt.modal.open('<i class="fa icon-note"></i> <@ctx.i18n text = "选择车辆"/>',
            baseURL  +"bpm/purchase/add/${taskId}/${id}","1600");
    }
</script>
</@footer>
</@pageTheme>